/** * @license * Copyright (c) 2014, 2018, Oracle and/or its affiliates. * The Universal Permissive License (UPL), Version 1.0 */ "use strict";define(["ojs/ojcore","jquery","ojL10n!ojtranslations/nls/localeElements","ojs/ojmessaging"],function(t,r,e){t.LocaleData={},t.LocaleData.setBundle=function(r){t.LocaleData._bundle=r},t.LocaleData.getFirstDayOfWeek=function(){return t.LocaleData._getWeekData("firstDay")},t.LocaleData.getWeekendStart=function(){return t.LocaleData._getWeekData("weekendStart")},t.LocaleData.getWeekendEnd=function(){return t.LocaleData._getWeekData("weekendEnd")},t.LocaleData.getDayNames=function(r){(null==r||"abbreviated"!==r&&"narrow"!==r)&&(r="wide");var e=t.LocaleData._getCalendarData().days["stand-alone"][r];return[e.sun,e.mon,e.tue,e.wed,e.thu,e.fri,e.sat]},t.LocaleData.getMonthNames=function(r){(null==r||"abbreviated"!==r&&"narrow"!==r)&&(r="wide");var e=t.LocaleData._getCalendarData().months["stand-alone"][r];return[e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8],e[9],e[10],e[11],e[12]]},t.LocaleData.isMonthPriorToYear=function(){var r=t.LocaleData._getCalendarData().dateFormats.long.toUpperCase();return r.indexOf("M")=2){var a=e[1];if(4!=a.length)return a;if(e.length>=3)return e[2]}}return null},t.LocaleData.__getBundle=function(){var r=t.LocaleData._bundle;return r||(t.__isAmdLoaderPresent()?(t.Assert.assert(void 0!==e,"LocaleElements module must be loaded"),e):{})},t.LocaleData.__updateBundle=function(t){e=t},t.OraI18nUtils={},t.OraI18nUtils.numeringSystems={latn:"0123456789",arab:"٠١٢٣٤٥٦٧٨٩",thai:"๐๑๒๓๔๕๖๗๘๙"},t.OraI18nUtils.regexTrim=/^\s+|\s+$|\u200f|\u200e/g,t.OraI18nUtils.regexTrimNumber=/\s+|\u200f|\u200e/g,t.OraI18nUtils.regexTrimRightZeros=/0+$/g,t.OraI18nUtils.zeros=["0","00","000"],t.OraI18nUtils._ISO_DATE_REGEXP=/^[+-]?\d{4}(?:-?\d{2}(?:-?\d{2})?)?(?:T\d{2}:?\d{2}(?::?\d{2}(?:\.\d{1,3})?)?(Z|[+-]\d{2}:\d{2})?)?$|^T\d{2}:?\d{2}(?::?\d{2}(?:\.\d{1,3})?)?(Z|[+-]\d{2}:\d{2})?$/,t.OraI18nUtils.getLocalTimeZoneOffset=function(){var r=(new Date).getTimezoneOffset();return t.OraI18nUtils.getTimeStringFromOffset("Etc/GMT",r,!1,!1)},t.OraI18nUtils.dateToLocalIso=function(r){var e=r;"number"==typeof e&&(e=new Date(e));var a=t.OraI18nUtils.padZeros(e.getFullYear(),4)+"-"+t.OraI18nUtils.padZeros(e.getMonth()+1,2)+"-"+t.OraI18nUtils.padZeros(e.getDate(),2)+"T"+t.OraI18nUtils.padZeros(e.getHours(),2)+":"+t.OraI18nUtils.padZeros(e.getMinutes(),2)+":"+t.OraI18nUtils.padZeros(e.getSeconds(),2);return e.getMilliseconds()>0&&(a+="."+t.OraI18nUtils.trimRightZeros(t.OraI18nUtils.padZeros(e.getMilliseconds(),3))),a},t.OraI18nUtils.partsToIsoString=function(r){var e=t.OraI18nUtils.padZeros(r[0],4)+"-"+t.OraI18nUtils.padZeros(r[1],2)+"-"+t.OraI18nUtils.padZeros(r[2],2)+"T"+t.OraI18nUtils.padZeros(r[3],2)+":"+t.OraI18nUtils.padZeros(r[4],2)+":"+t.OraI18nUtils.padZeros(r[5],2);return r[6]>0&&(e+="."+t.OraI18nUtils.trimRightZeros(t.OraI18nUtils.padZeros(r[6],3))),e},t.OraI18nUtils.isoToLocalDate=function(t){return t&&"string"==typeof t?this._isoToLocalDateIgnoreTimezone(t):null},t.OraI18nUtils._isoToLocalDateIgnoreTimezone=function(r){var e=t.OraI18nUtils._IsoStrParts(r);return new Date(e[0],e[1]-1,e[2],e[3],e[4],e[5],e[6])},t.OraI18nUtils._IsoStrParts=function(r){var e,a=r.split("T"),n=r.indexOf("T"),o=new Date,i=!1,s=[o.getFullYear(),o.getMonth()+1,o.getDate(),0,0,0,0];if(""!==a[0]){t.OraI18nUtils.startsWith(a[0],"-")&&(a[0]=a[0].substr(1),i=!0);var l=a[0].split("-");for(e=0;e1&&a.length=0:e<0,i=Math.abs(e),s=Math.floor(i/60),l=i%60,u=o?"-":"+";n&&(s=t.OraI18nUtils.zeroPad(s,2,!0));var c=r+u+s;return(l>0||n)&&(c+=":"+t.OraI18nUtils.zeroPad(l,2,!0)),c},t.OraI18nUtils.getNumberingSystemKey=function(r,e){if(void 0===e)return"latn";var a=t.OraI18nUtils.getNumberingExtension(e),n="symbols-numberSystem-"+a;return void 0===r.numbers[n]&&(a="latn"),a},t.OraI18nUtils.getBCP47Lang=function(t){return t.split("-")[0]},t.OraI18nUtils.getBCP47Region=function(t){var r=t.split("-");return 3===r.length?r[2]:2===r.length&&2===r[1].length?r[1]:"001"},t.OraI18nUtils.getNumberingExtension=function(t){var r=t||"en-US",e=r.indexOf("-u-nu-"),a="latn";return-1!==e&&(a=r.substr(e+6,4)),a},t.OraI18nUtils.haveSamePropertiesLength=function(t){return Object.keys(t).length},t.OraI18nUtils.getLocaleElementsMainNode=function(t){var r=t.main;return r[Object.keys(r)[0]]},t.OraI18nUtils.getLocaleElementsMainNodeKey=function(t){var r=t.main;return Object.keys(r)[0]},t.OraI18nUtils._toBoolean=function(t){if("string"==typeof t)switch(t.toLowerCase().trim()){case"true":case"1":return!0;case"false":case"0":return!1;default:return t}return t},t.OraI18nUtils.getGetOption=function(r,e){if(void 0===r)throw new Error("Internal "+e+" error. Default options missing.");return function(a,n,o,i){if(void 0!==r[a]){var s=r[a];switch(n){case"boolean":s=t.OraI18nUtils._toBoolean(s);break;case"string":s=String(s);break;case"number":s=Number(s);break;default:throw new Error("Internal error. Wrong value type.")}if(void 0!==o&&-1===o.indexOf(s)){for(var l=[],u=0;u6&&d[6]?"."+d[6]+(8===d.length&&d[7]?d[7]:""):"")}return s},t.OraI18nUtils._normalizeIsoString=function(t){if(!t)throw new Error("Provided invalid arguments");var r,e=(new Date).toISOString(),a=e.substring(0,e.indexOf("T")),n=t.indexOf("T"),o=-1===n?t:t.substring(0,n);return(o=o||a)+(-1!==n?(r=t.substring(n)).split(":").length>1?r:r+":00":"T00:00:00.000")},t.OraI18nUtils.formatString=function(t,r){for(var e=r.length,a=t,n=0;n0&&(a=t.charCodeAt(0)),a>=1536&&a<=1791)return"";if(a>=2304&&a<=2431)return t.charAt(0);if(a>=3584&&a<=3711)return t.charAt(0);if(a>=4352&&a<=4607||a>=12592&&a<=12687||a>=43360&&a<=43391||a>=44032&&a<=55295)return t;if(void 0!==r&&r.length>0&&(a=r.charCodeAt(0)),a>=11904&&a<=12255||a>=12288&&a<=12591||a>=12688&&a<=12799||a>=13056&&a<=19903||a>=19968&&a<=40959||a>=63744&&a<=64255)return r;if(a>=55296&&a<=56319){if(r.length<2)return"";if((n=r.charCodeAt(1))<56320||n>57343)return"";if((e=1024*(a-55296)+(n-56320)+65536)>=110592&&e<=110847||e>=127488&&e<=127743||e>=131072&&e<=173791||e>=173824&&e<=177983||e>=177984&&e<=178207||e>=178208&&e<=183983||e>=194560&&e<=195103)return r}return a="",n="",void 0!==t&&t.length>0&&(a=t.charAt(0).toUpperCase()),void 0!==r&&r.length>0&&(n=r.charAt(0).toUpperCase()),a+n},t.Validation={},t.Validation._converterFactories={},t.Validation._validatorFactories={},t.Validation._defaultConverterFactories={},t.Validation._defaultValidatorFactories={},t.Validation._CONTRACTS={converter:{name:"oj.ConverterFactory",type:t.ConverterFactory},validator:{name:"oj.ValidatorFactory",type:t.ValidatorFactory}},t.Validation.converterFactory=function(r,e){var a;return r&&!e?a=t.Validation._getFactory(r,t.Validation._converterFactories):r&&e&&(a=t.Validation._registerFactory(r,e,t.Validation._converterFactories,t.Validation._CONTRACTS.converter)),a},t.Validation.validatorFactory=function(r,e){var a;return r&&!e?a=t.Validation._getFactory(r,t.Validation._validatorFactories):r&&e&&(a=t.Validation._registerFactory(r,e,t.Validation._validatorFactories,t.Validation._CONTRACTS.validator)),a},t.Validation.getDefaultConverterFactory=function(r){return t.Validation._getFactory(r,t.Validation._defaultConverterFactories)},t.Validation.getDefaultValidatorFactory=function(r){return t.Validation._getFactory(r,t.Validation._defaultValidatorFactories)},t.Validation.__registerDefaultConverterFactory=function(r,e){var a=t.Validation._CONTRACTS.converter;t.Validation._registerFactory(r,e,t.Validation._defaultConverterFactories,a),t.Validation._registerFactory(r,e,t.Validation._converterFactories,a)},t.Validation.__registerDefaultValidatorFactory=function(r,e){var a=t.Validation._CONTRACTS.validator;t.Validation._registerFactory(r,e,t.Validation._defaultValidatorFactories,a),t.Validation._registerFactory(r,e,t.Validation._validatorFactories,a)},t.Validation._doImplementsCheck=function(r,e,a){if(e&&!t.Validation._quacksLike(r,e))throw new Error("Factory instance does not implement the methods expected by the factory of type "+a)},t.Validation._getFactory=function(r,e){t.Assert.assertString(r);var a=null;r&&(a=(e[r=r.toLowerCase()]||{}).instance||null);return a},t.Validation._quacksLike=function(r,e){var a,n=!0;for(a in t.Assert.assertObject(r),t.Assert.assertObject(e),e)if(e.hasOwnProperty(a)&&"function"==typeof e[a]&&!r[a]&&"function"!=typeof r[a]){n=!1;break}return n},t.Validation._registerFactory=function(r,e,a,n){if(t.Assert.assertString(r),t.Assert.assertObject(e),r){var o={};o.instance=e,t.Validation._doImplementsCheck(e,n.type,n.name),a[r.toLowerCase()]=o}},t.ConverterFactory={CONVERTER_TYPE_NUMBER:"number",CONVERTER_TYPE_DATETIME:"datetime",CONVERTER_TYPE_COLOR:"color",createConverter:function(t){}},t.ValidatorFactory={VALIDATOR_TYPE_REQUIRED:"required",VALIDATOR_TYPE_REGEXP:"regexp",VALIDATOR_TYPE_NUMBERRANGE:"numberRange",VALIDATOR_TYPE_LENGTH:"length",VALIDATOR_TYPE_DATETIMERANGE:"dateTimeRange",VALIDATOR_TYPE_DATERESTRICTION:"dateRestriction",createValidator:function(t){}},t.Converter=function(t){this.Init(t)},t.Object.createSubclass(t.Converter,t.Object,"oj.Converter"),t.Converter.prototype.Init=function(r){t.Converter.superclass.Init.call(this),this._options=r},t.Converter.prototype.getOptions=function(){return this._options||{}},t.Converter.prototype.resolvedOptions=function(){var t={};return r.extend(t,this._options),t},t.ConverterError=function(r,e){var a={summary:r,detail:e,severity:t.Message.SEVERITY_LEVEL.ERROR};this.Init(a)},t.ConverterError.prototype=new Error,t.ConverterError.prototype.Init=function(t){var r=t.detail,e=t.summary;this._message=t,this.name="Converter Error",this.message=r||e},t.ConverterError.prototype.getMessage=function(){return this._message},t.Validator=function(t){this.Init(t)},t.Object.createSubclass(t.Validator,t.Object,"oj.Validator"),t.Validator.prototype.Init=function(r){t.Validator.superclass.Init.call(this)},t.ValidatorError=function(r,e){var a={summary:r,detail:e,severity:t.Message.SEVERITY_LEVEL.ERROR};this.Init(a)},t.ValidatorError.prototype=new Error,t.ValidatorError.prototype.Init=function(t){var r=t.detail,e=t.summary;this._message=t,this.name="Validator Error",this.message=r||e},t.ValidatorError.prototype.getMessage=function(){return this._message},function(){function r(t,r){return"#"+function(t,r){return function(t,r,e,n){var o=[a(Math.round(t).toString(16)),a(Math.round(r).toString(16)),a(Math.round(e).toString(16))];if(n&&o[0].charAt(0)==o[0].charAt(1)&&o[1].charAt(0)==o[1].charAt(1)&&o[2].charAt(0)==o[2].charAt(1))return o[0].charAt(0)+o[1].charAt(0)+o[2].charAt(0);return o.join("")}(t._r,t._g,t._b,r)}(t,r)}function e(t,r){(function(t){return"string"==typeof t&&-1!=t.indexOf(".")&&1===parseFloat(t)})(t)&&(t="100%");var e=function(t){return"string"==typeof t&&-1!=t.indexOf("%")}(t);return t=Math.min(r,Math.max(0,parseFloat(t))),e&&(t=parseInt(t*r,10)/100),Math.abs(t-r)<1e-6?1:t%r/parseFloat(r)}function a(t){return 1==t.length?"0"+t:""+t}t.ColorConverter=function(t){this.Init(t)},t.Object.createSubclass(t.ColorConverter,t.Converter,"oj.ColorConverter"),t.ColorConverter.prototype.Init=function(r){(r=r||{}).format=r.format||"rgb",t.ColorConverter.superclass.Init.call(this,r)},t.ColorConverter.prototype.format=function(a){var n=this._getFormat(),o=null;return"rgb"===n?o=a.toString():"hsl"===n?o=function(t){var r=function(t,r,a){t=e(t,255),r=e(r,255),a=e(a,255);var n,o,i=Math.max(t,r,a),s=Math.min(t,r,a),l=(i+s)/2;if(i==s)n=o=0;else{var u=i-s;switch(o=l>.5?u/(2-i-s):u/(i+s),i){case t:n=(r-a)/u+(r0&&(t=r.substring(0,e)+t)}return t},t.IntlConverterUtils.__getConverterOptionError=function(r,e){t.Assert.assertObject(e);var a,n,o="",i="",s=e.propertyName;return"optionTypesMismatch"===r?(a=e.requiredPropertyName,n=e.requiredPropertyValueValid,o=t.Translations.getTranslatedString("oj-converter.optionTypesMismatch.summary",{propertyName:s,propertyValue:e.propertyValue,requiredPropertyName:a}),i=t.IntlConverterUtils._getOptionValueDetailMessage(a,n)):"optionTypeInvalid"===r?(s=e.propertyName,n=e.propertyValueValid,o=t.Translations.getTranslatedString("oj-converter.optionTypeInvalid.summary",{propertyName:s}),i=t.IntlConverterUtils._getOptionValueDetailMessage(s,n)):"optionOutOfRange"===r?(o=t.Translations.getTranslatedString("oj-converter.optionOutOfRange.summary",{propertyName:s,propertyValue:e.propertyValue}),n=e.propertyValueValid,i=t.IntlConverterUtils._getOptionValueDetailMessage(s,n)):"optionValueInvalid"===r&&(o=t.Translations.getTranslatedString("oj-converter.optionValueInvalid.summary",{propertyName:s,propertyValue:e.propertyValue}),n=e.propertyValueHint,i=t.IntlConverterUtils._getOptionValueDetailMessage(s,n)),new t.ConverterError(o,i)},t.IntlConverterUtils._getOptionValueDetailMessage=function(r,e){var a;return e?("string"==typeof e?a="oj-converter.optionHint.detail":(a="oj-converter.optionHint.detail-plural",e=e.join(t.Translations.getTranslatedString("oj-converter.plural-separator"))),t.Translations.getTranslatedString(a,{propertyName:r,propertyValueValid:e})):""},t.IntlConverterUtils.__getNullFormattedValue=function(){return""},t.IntlConverterUtils._copyTimeOver=function(r,e){return t.OraI18nUtils._copyTimeOver(r,e)},t.IntlConverterUtils._clearTime=function(r){return t.OraI18nUtils._clearTime(r)},t.IntlConverterUtils._dateTime=function(r,e,a){return t.OraI18nUtils._dateTime(r,e,a)},t.IntlConverterUtils._normalizeIsoString=function(r){return t.OraI18nUtils._normalizeIsoString(r)},t.IntlConverterUtils.getInitials=function(r,e){return t.OraI18nUtils.getInitials(r,e)},t.LengthValidator=function(t){this.Init(t)},t.LengthValidator.defaults={countBy:"codeUnit"},t.Object.createSubclass(t.LengthValidator,t.Validator,"oj.LengthValidator"),t.LengthValidator.prototype.Init=function(r){var e=r.countBy;if(t.LengthValidator.superclass.Init.call(this),this._min=void 0!==r.min?parseInt(r.min,10):null,this._max=void 0!==r.max?parseInt(r.max,10):null,isNaN(this._min))throw new Error("length validator's min option is not a number. min option is "+r.min);if(isNaN(this._max))throw new Error("length validator's max option is not a number. max option is "+r.min);if(null!==this._min&&this._min<0)throw new Error("length validator's min option cannot be less than 0. min option is "+r.min);if(null!==this._max&&this._max<1)throw new Error("length validator's max option cannot be less than 1. max option is "+r.max);this._countBy=void 0===e?t.LengthValidator.defaults.countBy:e,r&&(this._hint=r.hint||{},this._customMessageSummary=r.messageSummary||{},this._customMessageDetail=r.messageDetail||{})},t.LengthValidator.prototype.getHint=function(){var r,e=null,a=this._hint,n=a.exact,o=a.inRange,i=a.max,s=a.min,l=this._max,u=this._min,c=t.Translations;return null!==u&&null!==l?u!==l?(r={min:u,max:l},e=o?c.applyParameters(o,r):c.getTranslatedString("oj-validator.length.hint.inRange",r)):(r={length:u},e=n?c.applyParameters(n,r):c.getTranslatedString("oj-validator.length.hint.exact",r)):null!==u?(r={min:u},e=s?c.applyParameters(s,r):c.getTranslatedString("oj-validator.length.hint.min",r)):null!==l&&(r={max:l},e=i?c.applyParameters(i,r):c.getTranslatedString("oj-validator.length.hint.max",r)),e},t.LengthValidator.prototype.validate=function(r){var e,a,n,o=this._customMessageDetail,i=this._customMessageSummary,s="",l=this._max,u=i.tooLong,c=i.tooShort,d=o.tooLong,p=o.tooShort,g=this._min,f="",m=t.Translations;if(n=""+r,e=this._getLength(n),(null===g||e>=this._min)&&(null===l||e<=this._max))return n;throw e